import request from '../utils/request';

export function userTypeList(params) {
    let url = `api/auth/v1.0/user_type/list?page=${params.page}&per_page=${params.results}&q={"order_by": [{"field": "${params.sortField?params.sortField:'id'}", "direction": "${params.sortOrder?params.sortOrder:'desc'}"}]}`;
    
    return request(url);
}

export async function addUserType(params) {
    return request(`api/auth/v1.0/user_type`, {
      method: "POST",
      body: {
        ...params,
      },
    });
}

export async function updateUserType(params) {
    return request(`api/auth/v1.0/user_type?id=${params.id}`, {
      method: "PUT",
      body: {
        ...params,
      },
    });
}

export async function delUserType(params) {
    return request(`api/auth/v1.0/user_type?id=${params.id}`, {
      method: "DELETE",
    });
}